#ifndef TRAFFICSIM_WORLD
#define TRAFFICSIM_WORLD

#define	TILES_CARS_RATIO	10

#define min(X,Y) ((X) < (Y) ? (X) : (Y))

#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <time.h>

enum Direction {UP, DOWN, LEFT, RIGHT};

typedef struct Car
{
	int posx;
	int posy;
	const int velocity;
	enum Direction direction;
	
};

typedef struct Tile
{
	char type;
	char ncar;
	struct Car* cars[2];
};

typedef struct World
{
	struct Tile* map;
	struct Car* cars;
	int width;
	int height;
};

static void count_dims(FILE* file_pointer,int* dimensions);
void create(struct World* world,char* file);
void update(struct World* world);
void draw(struct World* world);
void get_tile(struct World* world,struct Tile* res_tile,int x,int y);
static enum Direction select_dir(struct Car* car,struct World* world);
void update_car(struct Car* car);


#endif